from appium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

desired_caps = {
    'platformName':'Android',
    'platformVersion': '7.1.2',
    'deviceName': 'emulator-5554',
    'appPackage': 'com.android.settings',
    'appActivity': '.Settings'
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
time.sleep(1)
driver.implicitly_wait(10)

# # 点击-wlan
# driver.find_element(By.XPATH, "//*[@text='WLAN']").click()
# time.sleep(3)

# # 返回
# driver.back()

# # 设置手机的网络模式
# driver.set_network_connection(1)

# # 截图
# driver.get_screenshot_as_file(r".\my.jpg")

# 获取屏幕宽高
print(driver.get_window_size())

time.sleep(5)
driver.quit()